<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title>新订订单 - 物流管理系统</title>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<style media="all" type="text/css">@import "../../style/all.css";</style>
	<script type="text/javascript" src="../../js/jquery-1.8.3.js"></script>
	<script type="text/javascript">
		$(function(){
			$("#btn2").click(function(){	
				var ordercounts = $("#ordercounts").val();
				var customerid = $("#customerid").val();
				var firstclass = $("#firstclass").val();
				var secondclass = $("#secondclass").val();
				var productname = $("#productname").val();
				var unit = $("#unit").val();
				var originalprice = $("#originalprice").val();
				var costprice = $("#costprice").val();
				var productinfo = $("#productinfo").val();
				var productremark = $("#productremark").val();
				if(ordercounts==null||ordercounts==""){
					alert("数量不能为空！");
					return false;
				}else{
				$.ajax({
					   type:"post", //四种提交类型：get、post、put、delete
					   url:"../addProduct",
					   contentType:"application/json",					
					   data:JSON.stringify({"firstclass": firstclass,"secondclass": secondclass,"productname":productname,"ordercounts":ordercounts,"unit": unit,"originalprice":originalprice,"costprice":costprice,"productinfo":productinfo,"productremark":productremark,"customerid":customerid}),
					   success:function(result){
						   alert(result);
						   window.location.href='../getAllfirstClass/'+customerid;
						   },				 
				   });
				}	
			});
		})
	</script>
</head>
<body style="background: none">
	<div class="top-bar">
		<!--a href="#" class="button">取 消</a><a href="#" class="button">保 存</a-->
		<h1>新订订单</h1>
		<div class="breadcrumbs">
			<a href="../../index.jsp" target="_top">首页</a> /
			<a href="../../cus_server/index.jsp" target="_top">客户服务中心</a>
		</div>
	</div>
	<div class="select-bar"/>
<form name="frm4" method="post">
	<div class="table">
		<img src="../style/img/bg-th-left.gif" width="8" height="7" alt="" class="left" />
		<img src="../style/img/bg-th-right.gif" width="7" height="7" alt="" class="right" />
		<table class="listing form" cellpadding="0" cellspacing="0">
			<tr>
				<th class="full" colspan="4">新订订单(*号为必填项)</th>
			</tr>
			<tr>
				<td width="25%" class="first style1" rowspan="2"><b>选择商品</td>
				<td width="25%"><b>一级分类</td>
				<td width="25%"><b>二级分类</td>
				<td width="25%"><b>商品名称</td>
			</tr>
			<tr>
				<td>
					<select size="10" style="width:100%" id="firstclass">
						<option>读数据库一类</option>
						<c:forEach items="${list }" var="list">
						    <option>${list.firstClass }</option>
						</c:forEach>
					</select>
				</td>
				<td>
					<select size="10" style="width:100%" id="secondclass">
						<option>读数据库二类</option>
						<c:forEach items="${list2 }" var="list2">
						    <option>${list2.secondClass }</option>
						</c:forEach>
					</select>
				</td>
				<td>
					<select size="10" style="width:100%" id="productname">
						<option>商品名称</option>
						<c:forEach items="${list3 }" var="list3">
						    <option>${list3.productname }</option>
						</c:forEach>
					</select>
				</td>
			</tr>
			<tr>
				<td class="first" >订购数量(*)</td>
				<td><input type="text" id="ordercounts" class="text" /></td>
				<td class="first">计量单位</td>
				<td><input type="text" class="text" id="unit" /></td>
			</tr>
			<tr >
				<td class="first">单价</td>
				<td><input type="text" class="text" id="originalprice" /></td>
				<td class="first">金额</td>
				<td><input type="text" class="text" id="costprice" /></td>
			</tr>
			<tr>
				<td class="first">商品说明</td>
				<td><input type="text" class="text" id="productinfo" /></td>
				<td class="first">备注信息</td>
				<td><input type="text" class="text" id="productremark" /></td>
			</tr>
			<tr>
				<td colspan="4" align="center">
				    <input type="hidden" value="${customerid }" id="customerid" />
					<input type="button" class="button" onclick="javascript:window.history.go(-1)" value="上一步"/>&nbsp;
					<input type="button" class="button" width="200" id="btn2" value="添加此商品"/>&nbsp;
					<input type="button" class="button" onclick="javascript:window.location='../getAllproductById/${customerid }'" value="下一步"/>
				</td>
			</tr>
		</table>
	</div>
</form>
</body>
</html>
